local skel = fk.CreateSkill{
  name = "big_master_skill",
}
Fk:loadTranslationTable{
  ["big_master_skill"] = "大师",
  [":big_master_skill"] = "大师",
  ["#big_master_skill"] = "交换两名其他角色的手牌",
}
---@type CardSkillSpec
local big_master = {
  prompt = "#big_master_skill",
  target_num = 2,
  mod_target_filter = function (self, player, to_select, selected, card, extra_data)
    return to_select ~= player
  end,
  target_filter = function (self, player, to_select, selected, selected_cards, card, extra_data)
    return Util.CardTargetFilter(self, player, to_select, selected, selected_cards, card, extra_data) and to_select ~= player
  end,
  on_use = function (self, room, cardUseEvent)
    if #cardUseEvent.tos ~= 2 then
      cardUseEvent:removeAllTargets()
    end
  end,
  about_to_effect = function (self, room, effect)
    local use = effect.use
    if not use or #effect:getAllTargets() ~= 2 then return true end
    use.extra_data = use.extra_data or {}
    use.extra_data.big_master_effect = use.extra_data.big_master_effect or {}
    use.extra_data.big_master_tos = use.extra_data.big_master_tos or {}
    if #use.extra_data.big_master_effect ~= #use.extra_data.big_master_tos then
      return true
    end
    table.insertIfNeed(use.extra_data.big_master_effect, effect.to) --记录已经询问的角色
    return false
  end,
  on_effect = function (self, room, effect)
    local use = effect.use
    if not use then return true end
    use.extra_data = use.extra_data or {}
    use.extra_data.big_master_tos = use.extra_data.big_master_tos or {}
    table.insertIfNeed(use.extra_data.big_master_tos, effect.to)
  end,
  on_action = function (self, room, use, finished)
    if finished and use.tos and #use.tos == 2 and use.extra_data and #use.extra_data.big_master_tos == 2 then
      local p1, p2 = use.extra_data.big_master_tos[1], use.extra_data.big_master_tos[2]
      room:swapAllCards(use.from, { p1, p2 }, skel.name)
    end
  end,
}
skel:addEffect("cardskill", big_master)
return skel